// Copyright(c) 2011 Matthew McMullan, Jorel Lalicki and Mike Heise, Jorel Lalicki and Mike Heise. See copying.txt for details.

#ifndef __agml_sincos_h__
#define __agml_sincos_h__

// make sure that this file is never included directly
#ifndef __agml_agml_h__
#error "Include AGML from agml.h only. This file is not a valid entry point for the library."
#endif

namespace agml {

struct sincos	{
	f32	sin;
	f32 cos;
};

inline sincos _sin_and_cos(f32 theta) {
	sincos sc;
	v128<f32> v;
    v.data[0] = theta;
    v.data[1] = (theta+_pi_2 > (f32)_pi) ? (theta+_pi_2 - (f32)_2pi) : (theta + _pi_2);
    //v.data[2] = v.data[3] = dontcare
	_sin(v.simd);
	sc.sin = v.data[0];
	sc.cos = v.data[1];
	return sc;
}

}//namespace

#endif
